package com.dhl.fin.api.domain;

import com.dhl.fin.api.common.annotation.Excel;
import com.dhl.fin.api.common.annotation.ExcelTitle;
import com.dhl.fin.api.common.domain.BasicDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;

/**
 * @author CuiJianbo
 * @since 2025/4/25
 */

/**
 * 借出记录
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Excel
@Entity
@Table(name = "t_lend_record")
public class LendRecord extends BasicDomain {

    /**
     * 借钱记录编号
     */
    @ExcelTitle(name = "借钱记录编号", width = 20, sort = 1)
    @Column(columnDefinition = "varchar(15)")
    private String recordNumber;

    /**
     * 借出金额
     */
    @ExcelTitle(name = "借出金额（元）", width = 20, sort = 3)
    private Integer lendMoneyAmount;

    /**
     * 借出人
     */
    @ExcelTitle(name = "借出人", width = 15, sort = 5)
    @Column(columnDefinition = "varchar(10)")
    private String lendName;

    /**
     * 借款人
     */
    @ExcelTitle(name = "借款人", width = 15, sort = 6)
    @Column(columnDefinition = "varchar(10)")
    private String borrowerName;

    /**
     * 借款年化利率
     */
    @ExcelTitle(name = "借款年化利率（%）", width = 20, sort = 7)
    @Column(columnDefinition = "decimal(10,2)")
    private Double lendYearRate;

    /**
     * 罚息年化利率
     */
    @ExcelTitle(name = "罚息年化利率（%）", width = 20, sort = 8)
    @Column(columnDefinition = "decimal(10,2)")
    private Double penaltyYearRate;

    /**
     * 当前借出利息总金额
     */
    @ExcelTitle(name = "当前总利息（元）", width = 20, sort = 9)
    @Column(columnDefinition = "decimal(10,2)")
    private Double currentTotalInterest;

    /**
     * 当前超期罚息总金额
     */
    @ExcelTitle(name = "当前总罚息（元）", width = 20, sort = 10)
    @Column(columnDefinition = "decimal(10,2)")
    private Double currentPenaltyTotalMoney;

    /**
     * 约定还款日期
     */
    private Date agreementRepayDate;

    /**
     * 实际还款日期
     */
    private Timestamp actualRepayDate;

    /**
     * 办理人
     */
    @ExcelTitle(name = "办理人", width = 10, sort = 13)
    @Column(columnDefinition = "varchar(10)")
    private String operator;

    /**
     * 是否已还完,  LendRecordStatusEnum
     */
    @Column(columnDefinition = "varchar(20)")
    private String lendRecordStatus;

    /**
     * 还款余额
     */
    @ExcelTitle(name = "还款余额", width = 12, sort = 4)
    private Integer lendBalance;

    /**
     * 备注
     */
    @ExcelTitle(name = "备注", width = 25, sort = 16)
    private String remark;

    /**
     * 标签
     */
    @ExcelTitle(name = "标签", width = 20, sort = 15)
    @Column(columnDefinition = "varchar(50)")
    private String tag;

    @ManyToOne
    @JoinColumn(name = "bank_account_id")
    private BankAccount bankAccount;

    @Transient
    @ExcelTitle(name = "借出状态", width = 15, sort = 2)
    private String lendRecordStatusName;

    @Transient
    @ExcelTitle(name = "实际还款日期", width = 18, sort = 12)
    private String actualRepayDateStr;

    @Transient
    @ExcelTitle(name = "约定还款日期", width = 18, sort = 11)
    private String agreementRepayDateStr;

    @Transient
    @ExcelTitle(name = "办理时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 24, sort = 14)
    private String createTimeStr;

}


